package com.nondo.rdp.finance.service.impl.analysis;

import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.finance.domain.analysis.Analysis;
import com.nondo.rdp.finance.domain.analysis.AnalysisComplain;
import com.nondo.rdp.finance.repository.analysis.AnalysisComplainRepository;
import com.nondo.rdp.finance.service.analysis.AnalysisComplainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class AnalysisComplainServiceImpl implements AnalysisComplainService {
    @Autowired
    AnalysisComplainRepository analysisComplainRepository;

    @Override
    public AnalysisComplain findOne(Long id) {
        return this.analysisComplainRepository.findOne(id);
    }

    @Override
    public AnalysisComplain save(AnalysisComplain analysisComplain) {
        return this.analysisComplainRepository.save(analysisComplain);
    }

    @Override
    public void delete(Long id) {
        this.analysisComplainRepository.deleteById(id);
    }

    @Override
    public AnalysisComplain findByAnalysisAndUser(Analysis analysis, User user) {
        return this.analysisComplainRepository.findByAnalysisAndUser(analysis, user);
    }
}